home *** CD-ROM | disk | FTP | other *** search
/ Macintosh Technology Seed 1996 September / Macintosh Technology Seed (September 1996) (CDRM1437020).ISO / pc / qd3d15d6 / 15d6_sdk.exe / QD3D Win32 1.5d6 / Interfaces / QD3DMath.h < prev    next >
C/C++ Source or Header  |  1996-08-21  |  26KB  |  895 lines

  1. /******************************************************************************
  2.  **                                                                             **
  3.  **     Module:        QD3DMath.h                                                 **
  4.  **                                                                          **
  5.  **                                                                          **
  6.  **     Purpose:     Math & matrix routines and definitions.                     **
  7.  **                                                                          **
  8.  **                                                                          **
  9.  **                                                                          **
  10.  **     Copyright (C) 1992-1996 Apple Computer, Inc.  All rights reserved.     **
  11.  **                                                                          **
  12.  **                                                                          ** 
  13.  *****************************************************************************/
  14. #ifndef QD3DMath_h
  15. #define QD3DMath_h
  16.  
  17. #if defined(PRAGMA_ONCE) && PRAGMA_ONCE
  18.     #pragma once
  19. #endif  /*  PRAGMA_ONCE  */
  20.  
  21. #include <math.h>
  22. #include <float.h>
  23.  
  24. #if defined(THINK_C) || defined(__SC__)
  25.     #pragma options(!pack_enums, !align_arrays)
  26.     #pragma SC options align=power
  27. #elif defined(__MWERKS__)
  28.     #pragma enumsalwaysint on
  29.     #pragma align_array_members off
  30.     #pragma options align=native
  31. #elif defined(__PPCC__)
  32.     #pragma options align=power
  33. #elif defined(__xlc) || defined(__xlC) || defined(__xlC__) || defined(__XLC121__)
  34.     #pragma options enum=int
  35. #endif
  36.  
  37. #ifdef __cplusplus
  38. extern "C" {
  39. #endif    /* __cplusplus */
  40.  
  41. /******************************************************************************
  42.  **                                                                             **
  43.  **                            Constant Definitions                             **
  44.  **                                                                             **
  45.  *****************************************************************************/
  46. /*
  47.  *  Real zero definition
  48.  */
  49. #ifdef FLT_EPSILON
  50. #    define kQ3RealZero            (FLT_EPSILON)
  51. #else
  52. #    define kQ3RealZero            ((float)1.19209290e-07)            
  53. #endif  /*  FLT_EPSILON  */
  54.  
  55. #ifdef FLT_MAX
  56. #    define    kQ3MaxFloat            (FLT_MAX)
  57. #else
  58. #    define    kQ3MaxFloat            ((float)3.40282347e+38)
  59. #endif  /*  FLT_MAX  */
  60.  
  61. /*
  62.  *  Values of PI
  63.  */
  64. #define kQ3Pi                     ((float)3.1415926535898)
  65. #define kQ32Pi                     ((float)(2.0 * 3.1415926535898))
  66. #define kQ3PiOver2                ((float)(3.1415926535898 / 2.0))
  67. #define kQ33PiOver2                ((float)(3.0 * 3.1415926535898 / 2.0))
  68.  
  69.  
  70. /******************************************************************************
  71.  **                                                                             **
  72.  **                            Miscellaneous Functions                             **
  73.  **                                                                             **
  74.  *****************************************************************************/
  75.  
  76. #define Q3Math_DegreesToRadians(x)    ((float)((x) *  kQ3Pi / 180.0))
  77. #define Q3Math_RadiansToDegrees(x)    ((float)((x) * 180.0 / kQ3Pi))
  78.  
  79. #define Q3Math_Min(x,y)                ((x) <= (y) ? (x) : (y))
  80. #define Q3Math_Max(x,y)                ((x) >= (y) ? (x) : (y))
  81.  
  82.         
  83. /******************************************************************************
  84.  **                                                                             **
  85.  **                            Point and Vector Creation                         **
  86.  **                                                                             **
  87.  *****************************************************************************/
  88.  
  89. QD3D_EXPORT TQ3Point2D *Q3Point2D_Set(
  90.     TQ3Point2D                    *point2D,
  91.     float                        x, 
  92.     float                        y);
  93.  
  94. QD3D_EXPORT TQ3Param2D *Q3Param2D_Set(
  95.     TQ3Param2D                    *param2D,
  96.     float                        u, 
  97.     float                        v);
  98.  
  99. QD3D_EXPORT TQ3Point3D *Q3Point3D_Set(
  100.     TQ3Point3D                    *point3D,
  101.     float                        x, 
  102.     float                        y, 
  103.     float                        z);
  104.  
  105. QD3D_EXPORT TQ3RationalPoint3D *Q3RationalPoint3D_Set(
  106.     TQ3RationalPoint3D            *point3D,
  107.     float                        x, 
  108.     float                        y, 
  109.     float                        w);
  110.     
  111. QD3D_EXPORT TQ3RationalPoint4D *Q3RationalPoint4D_Set(
  112.     TQ3RationalPoint4D            *point4D,
  113.     float                        x,
  114.     float                        y,
  115.     float                        z, 
  116.     float                        w);
  117.     
  118. QD3D_EXPORT TQ3Vector2D *Q3Vector2D_Set(
  119.     TQ3Vector2D                    *vector2D,
  120.     float                        x, 
  121.     float                        y);
  122.  
  123. QD3D_EXPORT TQ3Vector3D *Q3Vector3D_Set(
  124.     TQ3Vector3D                    *vector3D,
  125.     float                        x, 
  126.     float                        y, 
  127.     float                        z);
  128.  
  129. QD3D_EXPORT TQ3PolarPoint *Q3PolarPoint_Set(
  130.     TQ3PolarPoint                *polarPoint,
  131.     float                        r,
  132.     float                        theta);
  133.  
  134. QD3D_EXPORT TQ3SphericalPoint *Q3SphericalPoint_Set(
  135.     TQ3SphericalPoint            *sphericalPoint,
  136.     float                        rho,
  137.     float                        theta,
  138.     float                        phi);
  139.     
  140.     
  141. /******************************************************************************
  142.  **                                                                             **
  143.  **                    Point and Vector Dimension Conversion                     **
  144.  **                                                                             **
  145.  *****************************************************************************/
  146.  
  147. QD3D_EXPORT TQ3Point3D *Q3Point2D_To3D(
  148.     const TQ3Point2D            *point2D,
  149.     TQ3Point3D                    *result);
  150.  
  151. QD3D_EXPORT TQ3Point2D *Q3RationalPoint3D_To2D(
  152.     const TQ3RationalPoint3D    *point3D,
  153.     TQ3Point2D                    *result);
  154.     
  155. QD3D_EXPORT TQ3RationalPoint4D *Q3Point3D_To4D(
  156.     const TQ3Point3D            *point3D,
  157.     TQ3RationalPoint4D            *result);
  158.  
  159. QD3D_EXPORT TQ3Point3D *Q3RationalPoint4D_To3D(
  160.     const TQ3RationalPoint4D    *point4D,
  161.     TQ3Point3D                    *result);
  162.  
  163. QD3D_EXPORT TQ3Vector3D *Q3Vector2D_To3D(
  164.     const TQ3Vector2D            *vector2D,
  165.     TQ3Vector3D                    *result);
  166.     
  167. QD3D_EXPORT TQ3Vector2D *Q3Vector3D_To2D(
  168.     const TQ3Vector3D            *vector3D,
  169.     TQ3Vector2D                    *result);
  170.  
  171.     
  172. /******************************************************************************
  173.  **                                                                             **
  174.  **                            Point Subtraction                                 **
  175.  **                                                                             **
  176.  *****************************************************************************/
  177.  
  178. QD3D_EXPORT TQ3Vector2D *Q3Point2D_Subtract(
  179.     const TQ3Point2D            *p1, 
  180.     const TQ3Point2D            *p2,
  181.     TQ3Vector2D                    *result);
  182.  
  183. QD3D_EXPORT TQ3Vector2D *Q3Param2D_Subtract(
  184.     const TQ3Param2D            *p1, 
  185.     const TQ3Param2D            *p2,
  186.     TQ3Vector2D                    *result);
  187.  
  188. QD3D_EXPORT TQ3Vector3D *Q3Point3D_Subtract(
  189.     const TQ3Point3D            *p1, 
  190.     const TQ3Point3D            *p2,
  191.     TQ3Vector3D                    *result);
  192.     
  193.     
  194. /******************************************************************************
  195.  **                                                                             **
  196.  **                            Point Distance                                     **
  197.  **                                                                             **
  198.  *****************************************************************************/
  199.     
  200. QD3D_EXPORT float Q3Point2D_Distance(
  201.     const TQ3Point2D            *p1, 
  202.     const TQ3Point2D            *p2);
  203.  
  204. QD3D_EXPORT float Q3Point2D_DistanceSquared(
  205.     const TQ3Point2D            *p1, 
  206.     const TQ3Point2D            *p2);
  207.  
  208.  
  209. QD3D_EXPORT float Q3Param2D_Distance(
  210.     const TQ3Param2D            *p1, 
  211.     const TQ3Param2D            *p2);
  212.  
  213. QD3D_EXPORT float Q3Param2D_DistanceSquared(
  214.     const TQ3Param2D            *p1, 
  215.     const TQ3Param2D            *p2);
  216.     
  217.     
  218. QD3D_EXPORT float Q3RationalPoint3D_Distance(
  219.     const TQ3RationalPoint3D    *p1, 
  220.     const TQ3RationalPoint3D    *p2);
  221.     
  222. QD3D_EXPORT float Q3RationalPoint3D_DistanceSquared(
  223.     const TQ3RationalPoint3D    *p1, 
  224.     const TQ3RationalPoint3D    *p2);
  225.  
  226.  
  227. QD3D_EXPORT float Q3Point3D_Distance(
  228.     const TQ3Point3D            *p1, 
  229.     const TQ3Point3D            *p2);
  230.  
  231. QD3D_EXPORT float Q3Point3D_DistanceSquared(
  232.     const TQ3Point3D            *p1, 
  233.     const TQ3Point3D            *p2);
  234.  
  235.  
  236. QD3D_EXPORT float Q3RationalPoint4D_Distance(
  237.     const TQ3RationalPoint4D    *p1, 
  238.     const TQ3RationalPoint4D    *p2);
  239.  
  240. QD3D_EXPORT float Q3RationalPoint4D_DistanceSquared(
  241.     const TQ3RationalPoint4D    *p1, 
  242.     const TQ3RationalPoint4D    *p2);
  243.  
  244.  
  245. /******************************************************************************
  246.  **                                                                             **
  247.  **                            Point Relative Ratio                             **
  248.  **                                                                             **
  249.  *****************************************************************************/
  250.  
  251. QD3D_EXPORT TQ3Point2D *Q3Point2D_RRatio(
  252.     const TQ3Point2D            *p1,
  253.     const TQ3Point2D            *p2,
  254.     float                        r1,
  255.     float                        r2,
  256.     TQ3Point2D                    *result);
  257.  
  258. QD3D_EXPORT TQ3Param2D *Q3Param2D_RRatio(
  259.     const TQ3Param2D            *p1,
  260.     const TQ3Param2D            *p2,
  261.     float                        r1,
  262.     float                        r2,
  263.     TQ3Param2D                    *result);
  264.  
  265. QD3D_EXPORT TQ3Point3D *Q3Point3D_RRatio(
  266.     const TQ3Point3D            *p1,
  267.     const TQ3Point3D            *p2,
  268.     float                        r1,
  269.     float                        r2,
  270.     TQ3Point3D                    *result);
  271.  
  272. QD3D_EXPORT TQ3RationalPoint4D *Q3RationalPoint4D_RRatio(
  273.     const TQ3RationalPoint4D    *p1,
  274.     const TQ3RationalPoint4D    *p2,
  275.     float                        r1,
  276.     float                        r2,
  277.     TQ3RationalPoint4D            *result);
  278.                         
  279.                         
  280. /******************************************************************************
  281.  **                                                                             **
  282.  **                    Point / Vector Addition    & Subtraction                     **
  283.  **                                                                             **
  284.  *****************************************************************************/
  285.  
  286. QD3D_EXPORT TQ3Point2D *Q3Point2D_Vector2D_Add(
  287.     const TQ3Point2D            *point2D, 
  288.     const TQ3Vector2D            *vector2D,
  289.     TQ3Point2D                    *result);
  290.  
  291. QD3D_EXPORT TQ3Param2D *Q3Param2D_Vector2D_Add(
  292.     const TQ3Param2D            *param2D, 
  293.     const TQ3Vector2D            *vector2D,
  294.     TQ3Param2D                    *result);
  295.  
  296. QD3D_EXPORT TQ3Point3D *Q3Point3D_Vector3D_Add(
  297.     const TQ3Point3D            *point3D, 
  298.     const TQ3Vector3D            *vector3D,
  299.     TQ3Point3D                    *result);
  300.  
  301. QD3D_EXPORT TQ3Point2D *Q3Point2D_Vector2D_Subtract(
  302.     const TQ3Point2D            *point2D, 
  303.     const TQ3Vector2D            *vector2D,
  304.     TQ3Point2D                    *result);
  305.  
  306. QD3D_EXPORT TQ3Param2D *Q3Param2D_Vector2D_Subtract(
  307.     const TQ3Param2D            *param2D, 
  308.     const TQ3Vector2D            *vector2D,
  309.     TQ3Param2D                    *result);
  310.  
  311. QD3D_EXPORT TQ3Point3D *Q3Point3D_Vector3D_Subtract(
  312.     const TQ3Point3D            *point3D, 
  313.     const TQ3Vector3D            *vector3D,
  314.     TQ3Point3D                    *result);
  315.  
  316.  
  317. /******************************************************************************
  318.  **                                                                             **
  319.  **                                Vector Scale                                 **
  320.  **                                                                             **
  321.  *****************************************************************************/
  322.                         
  323. QD3D_EXPORT TQ3Vector2D *Q3Vector2D_Scale(
  324.     const TQ3Vector2D            *vector2D, 
  325.     float                        scalar,
  326.     TQ3Vector2D                    *result);
  327.  
  328. QD3D_EXPORT TQ3Vector3D *Q3Vector3D_Scale(
  329.     const TQ3Vector3D            *vector3D, 
  330.     float                        scalar,
  331.     TQ3Vector3D                    *result);
  332.  
  333.     
  334. /******************************************************************************
  335.  **                                                                             **
  336.  **                                Vector Length                                 **
  337.  **                                                                             **
  338.  *****************************************************************************/
  339.  
  340. QD3D_EXPORT float Q3Vector2D_Length(
  341.     const TQ3Vector2D             *vector2D);
  342.  
  343. QD3D_EXPORT float Q3Vector3D_Length(
  344.     const TQ3Vector3D            *vector3D);
  345.  
  346.     
  347. /******************************************************************************
  348.  **                                                                             **
  349.  **                                Vector Normalize                             **
  350.  **                                                                             **
  351.  *****************************************************************************/
  352.  
  353. QD3D_EXPORT TQ3Vector2D *Q3Vector2D_Normalize(
  354.     const TQ3Vector2D            *vector2D,
  355.     TQ3Vector2D                    *result);
  356.  
  357. QD3D_EXPORT TQ3Vector3D *Q3Vector3D_Normalize(
  358.     const TQ3Vector3D            *vector3D,
  359.     TQ3Vector3D                    *result);
  360.  
  361.  
  362. /******************************************************************************
  363.  **                                                                             **
  364.  **                    Vector/Vector Addition and Subtraction                     **
  365.  **                                                                             **
  366.  *****************************************************************************/
  367.  
  368. QD3D_EXPORT TQ3Vector2D *Q3Vector2D_Add(
  369.     const TQ3Vector2D            *v1, 
  370.     const TQ3Vector2D            *v2,
  371.     TQ3Vector2D                    *result);
  372.  
  373. QD3D_EXPORT TQ3Vector3D *Q3Vector3D_Add(
  374.     const TQ3Vector3D            *v1, 
  375.     const TQ3Vector3D            *v2, 
  376.     TQ3Vector3D                    *result);
  377.  
  378.  
  379. QD3D_EXPORT TQ3Vector2D *Q3Vector2D_Subtract(
  380.     const TQ3Vector2D            *v1, 
  381.     const TQ3Vector2D            *v2, 
  382.     TQ3Vector2D                    *result);
  383.  
  384. QD3D_EXPORT TQ3Vector3D *Q3Vector3D_Subtract(
  385.     const TQ3Vector3D            *v1, 
  386.     const TQ3Vector3D            *v2,
  387.     TQ3Vector3D                    *result);
  388.  
  389.  
  390. /******************************************************************************
  391.  **                                                                             **
  392.  **                                Cross Product                                 **
  393.  **                                                                             **
  394.  *****************************************************************************/
  395.  
  396. QD3D_EXPORT float Q3Vector2D_Cross(
  397.     const TQ3Vector2D            *v1, 
  398.     const TQ3Vector2D            *v2);
  399.  
  400. QD3D_EXPORT TQ3Vector3D *Q3Vector3D_Cross(
  401.     const TQ3Vector3D            *v1, 
  402.     const TQ3Vector3D            *v2,
  403.     TQ3Vector3D                    *result);
  404.     
  405. QD3D_EXPORT TQ3Vector3D *Q3Point3D_CrossProductTri(
  406.     const TQ3Point3D             *point1, 
  407.     const TQ3Point3D             *point2, 
  408.     const TQ3Point3D             *point3, 
  409.     TQ3Vector3D                 *crossVector);
  410.  
  411.  
  412. /******************************************************************************
  413.  **                                                                             **
  414.  **                                Dot Product                                     **
  415.  **                                                                             **
  416.  *****************************************************************************/
  417.  
  418. QD3D_EXPORT float Q3Vector2D_Dot(
  419.     const TQ3Vector2D            *v1, 
  420.     const TQ3Vector2D            *v2);
  421.  
  422. QD3D_EXPORT float Q3Vector3D_Dot(
  423.     const TQ3Vector3D            *v1, 
  424.     const TQ3Vector3D            *v2);
  425.  
  426.  
  427. /******************************************************************************
  428.  **                                                                             **
  429.  **                        Point and Vector Transformation                         **
  430.  **                                                                             **
  431.  *****************************************************************************/
  432.  
  433. QD3D_EXPORT TQ3Vector2D *Q3Vector2D_Transform(
  434.     const TQ3Vector2D            *vector2D,
  435.     const TQ3Matrix3x3             *matrix3x3,
  436.     TQ3Vector2D                    *result);
  437.     
  438. QD3D_EXPORT TQ3Vector3D *Q3Vector3D_Transform(
  439.     const TQ3Vector3D            *vector3D,
  440.     const TQ3Matrix4x4            *matrix4x4,
  441.     TQ3Vector3D                    *result);
  442.  
  443. QD3D_EXPORT TQ3Point2D *Q3Point2D_Transform(
  444.     const TQ3Point2D             *point2D,
  445.     const TQ3Matrix3x3            *matrix3x3,
  446.     TQ3Point2D                    *result);
  447.  
  448. QD3D_EXPORT TQ3Param2D *Q3Param2D_Transform(
  449.     const TQ3Param2D             *param2D,
  450.     const TQ3Matrix3x3            *matrix3x3,
  451.     TQ3Param2D                    *result);
  452.  
  453. QD3D_EXPORT TQ3Point3D *Q3Point3D_Transform(
  454.     const TQ3Point3D            *point3D,
  455.     const TQ3Matrix4x4            *matrix4x4,
  456.     TQ3Point3D                    *result);
  457.  
  458. QD3D_EXPORT TQ3RationalPoint4D *Q3RationalPoint4D_Transform(
  459.     const TQ3RationalPoint4D    *point4D, 
  460.     const TQ3Matrix4x4            *matrix4x4,
  461.     TQ3RationalPoint4D            *result);
  462.     
  463. QD3D_EXPORT TQ3Status Q3Point3D_To3DTransformArray(
  464.     const TQ3Point3D             *inPoint3D, 
  465.     const TQ3Matrix4x4             *matrix,
  466.     TQ3Point3D                     *outPoint3D,  
  467.     long                         numPoints, 
  468.     unsigned long                 inStructSize, 
  469.     unsigned long                 outStructSize);
  470.     
  471. QD3D_EXPORT TQ3Status Q3Point3D_To4DTransformArray(
  472.     const TQ3Point3D             *inPoint3D, 
  473.     const TQ3Matrix4x4             *matrix,
  474.     TQ3RationalPoint4D             *outPoint4D,  
  475.     long                         numPoints,
  476.     unsigned long                 inStructSize, 
  477.     unsigned long                 outStructSize);
  478.     
  479. QD3D_EXPORT TQ3Status Q3RationalPoint4D_To4DTransformArray(
  480.     const TQ3RationalPoint4D     *inPoint4D, 
  481.     const TQ3Matrix4x4             *matrix,
  482.     TQ3RationalPoint4D             *outPoint4D,  
  483.     long                         numPoints, 
  484.     unsigned long                 inStructSize, 
  485.     unsigned long                 outStructSize);
  486.  
  487.  
  488. /******************************************************************************
  489.  **                                                                             **
  490.  **                                Vector Negation                                 **
  491.  **                                                                             **
  492.  *****************************************************************************/
  493.  
  494. QD3D_EXPORT TQ3Vector2D *Q3Vector2D_Negate(
  495.     const TQ3Vector2D            *vector2D,
  496.     TQ3Vector2D                    *result);
  497.  
  498. QD3D_EXPORT TQ3Vector3D *Q3Vector3D_Negate(
  499.     const TQ3Vector3D            *vector3D,
  500.     TQ3Vector3D                    *result);
  501.  
  502.  
  503. /******************************************************************************
  504.  **                                                                             **
  505.  **                    Point conversion from cartesian to polar                 **
  506.  **                                                                             **
  507.  *****************************************************************************/
  508.  
  509. QD3D_EXPORT TQ3PolarPoint *Q3Point2D_ToPolar(
  510.     const TQ3Point2D            *point2D,
  511.     TQ3PolarPoint                *result);
  512.     
  513. QD3D_EXPORT TQ3Point2D *Q3PolarPoint_ToPoint2D(
  514.     const TQ3PolarPoint            *polarPoint,
  515.     TQ3Point2D                    *result);
  516.     
  517. QD3D_EXPORT TQ3SphericalPoint *Q3Point3D_ToSpherical(
  518.     const TQ3Point3D            *point3D,
  519.     TQ3SphericalPoint            *result);
  520.     
  521. QD3D_EXPORT TQ3Point3D *Q3SphericalPoint_ToPoint3D(
  522.     const TQ3SphericalPoint        *sphericalPoint,
  523.     TQ3Point3D                    *result);
  524.  
  525.  
  526. /******************************************************************************
  527.  **                                                                             **
  528.  **                            Point Affine Combinations                         **
  529.  **                                                                             **
  530.  *****************************************************************************/
  531.  
  532. QD3D_EXPORT TQ3Point2D *Q3Point2D_AffineComb(
  533.     const TQ3Point2D            *points2D,
  534.     const float                    *weights,
  535.     unsigned long                nPoints, 
  536.     TQ3Point2D                    *result);
  537.  
  538. QD3D_EXPORT TQ3Param2D *Q3Param2D_AffineComb(
  539.     const TQ3Param2D            *params2D,
  540.     const float                    *weights,
  541.     unsigned long                nPoints, 
  542.     TQ3Param2D                    *result);
  543.  
  544. QD3D_EXPORT TQ3RationalPoint3D *Q3RationalPoint3D_AffineComb(
  545.     const TQ3RationalPoint3D    *points3D,
  546.     const float                    *weights,
  547.     unsigned long                numPoints, 
  548.     TQ3RationalPoint3D            *result);
  549.     
  550. QD3D_EXPORT TQ3Point3D *Q3Point3D_AffineComb(
  551.     const TQ3Point3D            *points3D,
  552.     const float                    *weights,
  553.     unsigned long                numPoints, 
  554.     TQ3Point3D                    *result);
  555.  
  556. QD3D_EXPORT TQ3RationalPoint4D *Q3RationalPoint4D_AffineComb(
  557.     const TQ3RationalPoint4D    *points4D,
  558.     const float                    *weights,
  559.     unsigned long                numPoints, 
  560.     TQ3RationalPoint4D            *result);
  561.     
  562.     
  563. /******************************************************************************
  564.  **                                                                             **
  565.  **                                Matrix Functions                             **
  566.  **                                                                             **
  567.  *****************************************************************************/
  568.  
  569. QD3D_EXPORT TQ3Matrix3x3 *Q3Matrix3x3_Copy(
  570.     const TQ3Matrix3x3            *matrix3x3,
  571.     TQ3Matrix3x3                *result);
  572.     
  573. QD3D_EXPORT TQ3Matrix4x4 *Q3Matrix4x4_Copy(
  574.     const TQ3Matrix4x4            *matrix4x4,
  575.     TQ3Matrix4x4                *result);
  576.  
  577.  
  578. QD3D_EXPORT TQ3Matrix3x3 *Q3Matrix3x3_SetIdentity(
  579.     TQ3Matrix3x3                *matrix3x3);
  580.  
  581. QD3D_EXPORT TQ3Matrix4x4 *Q3Matrix4x4_SetIdentity(
  582.     TQ3Matrix4x4                *matrix4x4);
  583.  
  584.  
  585. QD3D_EXPORT TQ3Matrix3x3 *Q3Matrix3x3_Transpose(
  586.     const TQ3Matrix3x3            *matrix3x3,
  587.     TQ3Matrix3x3                *result);
  588.  
  589. QD3D_EXPORT TQ3Matrix4x4 *Q3Matrix4x4_Transpose(
  590.     const TQ3Matrix4x4            *matrix4x4,
  591.     TQ3Matrix4x4                *result);
  592.  
  593.  
  594. QD3D_EXPORT TQ3Matrix3x3 *Q3Matrix3x3_Invert(
  595.     const TQ3Matrix3x3            *matrix3x3,
  596.     TQ3Matrix3x3                *result);
  597.  
  598. QD3D_EXPORT TQ3Matrix4x4 *Q3Matrix4x4_Invert(
  599.     const TQ3Matrix4x4            *matrix4x4,
  600.     TQ3Matrix4x4                *result);
  601.     
  602.     
  603. QD3D_EXPORT TQ3Matrix3x3 *Q3Matrix3x3_Adjoint(
  604.     const TQ3Matrix3x3            *matrix3x3,
  605.     TQ3Matrix3x3                *result);
  606.  
  607.  
  608. QD3D_EXPORT TQ3Matrix3x3 *Q3Matrix3x3_Multiply(
  609.     const TQ3Matrix3x3            *matrixA,
  610.     const TQ3Matrix3x3            *matrixB,
  611.     TQ3Matrix3x3                *result);
  612.  
  613. QD3D_EXPORT TQ3Matrix4x4 *Q3Matrix4x4_Multiply(
  614.     const TQ3Matrix4x4            *matrixA,
  615.     const TQ3Matrix4x4            *matrixB,
  616.     TQ3Matrix4x4                *result);
  617.  
  618.  
  619. QD3D_EXPORT TQ3Matrix3x3 *Q3Matrix3x3_SetTranslate(
  620.     TQ3Matrix3x3                *matrix3x3,    
  621.     float                        xTrans,
  622.     float                        yTrans);
  623.  
  624. QD3D_EXPORT TQ3Matrix3x3 *Q3Matrix3x3_SetScale(
  625.     TQ3Matrix3x3                *matrix3x3,
  626.     float                        xScale,
  627.     float                        yScale);
  628.  
  629.  
  630. QD3D_EXPORT TQ3Matrix3x3 *Q3Matrix3x3_SetRotateAboutPoint(
  631.     TQ3Matrix3x3                *matrix3x3,
  632.     const TQ3Point2D            *origin,
  633.     float                        angle);
  634.  
  635. QD3D_EXPORT TQ3Matrix4x4 *Q3Matrix4x4_SetTranslate(
  636.     TQ3Matrix4x4                *matrix4x4,
  637.     float                        xTrans,
  638.     float                        yTrans,
  639.     float                        zTrans);
  640.  
  641. QD3D_EXPORT TQ3Matrix4x4 *Q3Matrix4x4_SetScale(
  642.     TQ3Matrix4x4                *matrix4x4,
  643.     float                        xScale,
  644.     float                        yScale,
  645.     float                        zScale);
  646.  
  647.  
  648. QD3D_EXPORT TQ3Matrix4x4 *Q3Matrix4x4_SetRotateAboutPoint(
  649.     TQ3Matrix4x4                *matrix4x4,
  650.     const TQ3Point3D            *origin,
  651.     float                        xAngle,
  652.     float                        yAngle,
  653.     float                        zAngle);
  654.     
  655. QD3D_EXPORT TQ3Matrix4x4 *Q3Matrix4x4_SetRotateAboutAxis(
  656.     TQ3Matrix4x4                *matrix4x4,
  657.     const TQ3Point3D            *origin,
  658.     const TQ3Vector3D            *orientation,   
  659.     float                        angle);    
  660.     
  661. QD3D_EXPORT TQ3Matrix4x4 *Q3Matrix4x4_SetRotate_X(
  662.     TQ3Matrix4x4                *matrix4x4,
  663.     float                        angle);
  664.     
  665. QD3D_EXPORT TQ3Matrix4x4 *Q3Matrix4x4_SetRotate_Y(
  666.     TQ3Matrix4x4                *matrix4x4,
  667.     float                        angle);
  668.  
  669. QD3D_EXPORT TQ3Matrix4x4 *Q3Matrix4x4_SetRotate_Z(
  670.     TQ3Matrix4x4                *matrix4x4,
  671.     float                        angle);
  672.         
  673. QD3D_EXPORT TQ3Matrix4x4 *Q3Matrix4x4_SetRotate_XYZ(
  674.     TQ3Matrix4x4                *matrix4x4,
  675.     float                        xAngle,
  676.     float                        yAngle,
  677.     float                        zAngle);                            
  678.                             
  679. QD3D_EXPORT TQ3Matrix4x4 *Q3Matrix4x4_SetRotateVectorToVector(
  680.     TQ3Matrix4x4                *matrix4x4,
  681.     const TQ3Vector3D            *v1,
  682.     const TQ3Vector3D            *v2);
  683.  
  684. QD3D_EXPORT TQ3Matrix4x4 *Q3Matrix4x4_SetQuaternion(
  685.     TQ3Matrix4x4                 *matrix, 
  686.     const TQ3Quaternion         *quaternion);
  687.  
  688. QD3D_EXPORT float Q3Matrix3x3_Determinant(
  689.     const TQ3Matrix3x3            *matrix3x3);
  690.  
  691. QD3D_EXPORT float Q3Matrix4x4_Determinant(
  692.     const TQ3Matrix4x4            *matrix4x4);
  693.     
  694.     
  695. /******************************************************************************
  696.  **                                                                             **
  697.  **                                Quaternion Routines                             **
  698.  **                                                                             **
  699.  *****************************************************************************/
  700.  
  701. QD3D_EXPORT TQ3Quaternion *Q3Quaternion_Set(
  702.     TQ3Quaternion                *quaternion,
  703.     float                        w,
  704.     float                        x,
  705.     float                        y,
  706.     float                        z);
  707.     
  708. QD3D_EXPORT TQ3Quaternion *Q3Quaternion_SetIdentity(
  709.     TQ3Quaternion                *quaternion);
  710.     
  711. QD3D_EXPORT TQ3Quaternion *Q3Quaternion_Copy(
  712.     const TQ3Quaternion            *quaternion, 
  713.     TQ3Quaternion                 *result);
  714.  
  715. QD3D_EXPORT TQ3Boolean Q3Quaternion_IsIdentity(
  716.     const TQ3Quaternion            *quaternion);
  717.  
  718. QD3D_EXPORT TQ3Quaternion *Q3Quaternion_Invert(
  719.     const TQ3Quaternion         *quaternion,
  720.     TQ3Quaternion                *result);
  721.  
  722. QD3D_EXPORT TQ3Quaternion *Q3Quaternion_Normalize(
  723.     const TQ3Quaternion            *quaternion,
  724.     TQ3Quaternion                *result);
  725.  
  726. QD3D_EXPORT float Q3Quaternion_Dot(
  727.     const TQ3Quaternion         *q1, 
  728.     const TQ3Quaternion         *q2);
  729.  
  730. QD3D_EXPORT TQ3Quaternion *Q3Quaternion_Multiply(
  731.     const TQ3Quaternion            *q1, 
  732.     const TQ3Quaternion            *q2,
  733.     TQ3Quaternion                *result);
  734.  
  735. QD3D_EXPORT TQ3Quaternion *Q3Quaternion_SetRotateAboutAxis(
  736.     TQ3Quaternion                 *quaternion, 
  737.     const TQ3Vector3D             *axis, 
  738.     float                         angle);
  739.     
  740. QD3D_EXPORT TQ3Quaternion *Q3Quaternion_SetRotateXYZ(
  741.     TQ3Quaternion                 *quaternion, 
  742.     float                         xAngle, 
  743.     float                         yAngle, 
  744.     float                         zAngle);
  745.     
  746. QD3D_EXPORT TQ3Quaternion *Q3Quaternion_SetRotateX(
  747.     TQ3Quaternion                 *quaternion, 
  748.     float                         angle);
  749.  
  750. QD3D_EXPORT TQ3Quaternion *Q3Quaternion_SetRotateY(
  751.     TQ3Quaternion                 *quaternion, 
  752.     float                         angle);
  753.  
  754. QD3D_EXPORT TQ3Quaternion *Q3Quaternion_SetRotateZ(
  755.     TQ3Quaternion                 *quaternion, 
  756.     float                         angle);
  757.  
  758. QD3D_EXPORT TQ3Quaternion *Q3Quaternion_SetMatrix(
  759.     TQ3Quaternion                 *quaternion, 
  760.     const TQ3Matrix4x4             *matrix);
  761.  
  762. QD3D_EXPORT TQ3Quaternion *Q3Quaternion_SetRotateVectorToVector(
  763.     TQ3Quaternion                 *quaternion, 
  764.     const TQ3Vector3D             *v1, 
  765.     const TQ3Vector3D             *v2);
  766.  
  767. QD3D_EXPORT TQ3Quaternion *Q3Quaternion_MatchReflection(
  768.     const TQ3Quaternion            *q1, 
  769.     const TQ3Quaternion         *q2,
  770.     TQ3Quaternion                *result);
  771.  
  772. QD3D_EXPORT TQ3Quaternion *Q3Quaternion_InterpolateFast(
  773.     const TQ3Quaternion         *q1, 
  774.     const TQ3Quaternion         *q2, 
  775.     float                         t,
  776.     TQ3Quaternion                *result);
  777.  
  778. QD3D_EXPORT TQ3Quaternion *Q3Quaternion_InterpolateLinear(
  779.     const TQ3Quaternion         *q1, 
  780.     const TQ3Quaternion         *q2, 
  781.     float                         t,
  782.     TQ3Quaternion                 *result);
  783.  
  784. QD3D_EXPORT TQ3Vector3D *Q3Vector3D_TransformQuaternion(
  785.     const TQ3Vector3D             *vector3D, 
  786.     const TQ3Quaternion         *quaternion,
  787.     TQ3Vector3D                    *result);
  788.  
  789. QD3D_EXPORT TQ3Point3D *Q3Point3D_TransformQuaternion(
  790.     const TQ3Point3D             *point3D, 
  791.     const TQ3Quaternion         *quaternion,
  792.     TQ3Point3D                    *result);
  793.  
  794.  
  795. /******************************************************************************
  796.  **                                                                             **
  797.  **                                Volume Routines                                 **
  798.  **                                                                             **
  799.  *****************************************************************************/
  800.  
  801. QD3D_EXPORT TQ3BoundingBox *Q3BoundingBox_Copy(
  802.     const TQ3BoundingBox         *src, 
  803.     TQ3BoundingBox                 *dest);
  804.     
  805. QD3D_EXPORT TQ3BoundingBox *Q3BoundingBox_Union(
  806.     const TQ3BoundingBox         *v1, 
  807.     const TQ3BoundingBox         *v2,
  808.     TQ3BoundingBox                *result);
  809.     
  810. QD3D_EXPORT TQ3BoundingBox *Q3BoundingBox_Set(
  811.     TQ3BoundingBox                 *bBox,
  812.     const TQ3Point3D             *min, 
  813.     const TQ3Point3D             *max,
  814.     TQ3Boolean                    isEmpty);
  815.     
  816. QD3D_EXPORT TQ3BoundingBox *Q3BoundingBox_UnionPoint3D(
  817.     const TQ3BoundingBox         *bBox,
  818.     const TQ3Point3D             *point3D,
  819.     TQ3BoundingBox                *result);
  820.     
  821. QD3D_EXPORT TQ3BoundingBox *Q3BoundingBox_UnionRationalPoint4D(
  822.     const TQ3BoundingBox         *bBox,
  823.     const TQ3RationalPoint4D     *point4D, 
  824.     TQ3BoundingBox                 *result);
  825.  
  826. QD3D_EXPORT TQ3BoundingBox *Q3BoundingBox_SetFromPoints3D(
  827.     TQ3BoundingBox                 *bBox, 
  828.     const TQ3Point3D             *points3D, 
  829.     unsigned long                 numPoints,
  830.     unsigned long                structSize);
  831.     
  832. QD3D_EXPORT TQ3BoundingBox *Q3BoundingBox_SetFromRationalPoints4D(
  833.     TQ3BoundingBox                 *bBox, 
  834.     const TQ3RationalPoint4D     *points4D, 
  835.     unsigned long                 numPoints,
  836.     unsigned long                structSize);
  837.  
  838.  
  839. /******************************************************************************
  840.  **                                                                             **
  841.  **                                Sphere Routines                                 **
  842.  **                                                                             **
  843.  *****************************************************************************/
  844.  
  845. QD3D_EXPORT TQ3BoundingSphere *Q3BoundingSphere_Copy(
  846.     const TQ3BoundingSphere     *src, 
  847.     TQ3BoundingSphere             *dest);
  848.     
  849. QD3D_EXPORT TQ3BoundingSphere *Q3BoundingSphere_Union(
  850.     const TQ3BoundingSphere     *s1, 
  851.     const TQ3BoundingSphere     *s2,
  852.     TQ3BoundingSphere            *result);
  853.  
  854. QD3D_EXPORT TQ3BoundingSphere *Q3BoundingSphere_Set(
  855.     TQ3BoundingSphere             *bSphere,
  856.     const TQ3Point3D             *origin, 
  857.     float                        radius,
  858.     TQ3Boolean                    isEmpty);
  859.     
  860. QD3D_EXPORT TQ3BoundingSphere *Q3BoundingSphere_UnionPoint3D(
  861.     const TQ3BoundingSphere     *bSphere,
  862.     const TQ3Point3D             *point3D,
  863.     TQ3BoundingSphere            *result);
  864.     
  865. QD3D_EXPORT TQ3BoundingSphere *Q3BoundingSphere_UnionRationalPoint4D(
  866.     const TQ3BoundingSphere     *bSphere,
  867.     const TQ3RationalPoint4D     *point4D, 
  868.     TQ3BoundingSphere             *result);
  869.  
  870.     
  871. QD3D_EXPORT TQ3BoundingSphere *Q3BoundingSphere_SetFromPoints3D(
  872.     TQ3BoundingSphere             *bSphere, 
  873.     const TQ3Point3D             *points3D, 
  874.     unsigned long                 numPoints,
  875.     unsigned long                structSize);
  876.     
  877. QD3D_EXPORT TQ3BoundingSphere *Q3BoundingSphere_SetFromRationalPoints4D(
  878.     TQ3BoundingSphere             *bSphere, 
  879.     const TQ3RationalPoint4D     *points4D, 
  880.     unsigned long                 numPoints,
  881.     unsigned long                structSize);    
  882.  
  883.  
  884. #ifdef __cplusplus
  885. }
  886. #endif    /* __cplusplus */
  887.  
  888. #if defined(__MWERKS__)
  889.     #pragma enumsalwaysint reset
  890. #elif defined(__xlc) || defined(__xlC) || defined(__xlC__) || defined(__XLC121__)
  891.     #pragma options enum=reset
  892. #endif
  893.  
  894. #endif  /*  QD3DMath_h  */
  895.